<template>
	<div>
		<el-container>
		<el-aside width="25%">
		<div class="selectRegister" >
				<el-form ref="Register"  :model="user" label-width="80px">
					<el-form-item label="姓名:">
				     <el-input v-model="user.RealName" placeholder="请输入查询的姓名"></el-input>
					  				        </el-form-item>
					  				        <el-form-item label="病历号:">
					  				            <el-input v-model="user.CaseNumber" placeholder="请输入查询的病历号"></el-input>
					  				        </el-form-item>
					  				      </el-form>
					  					  <div align="center">
					  						  <el-button @click="selectRegister()">查询</el-button>
					  					  </div>			  					  
					  				  </div>
					  				  <div style="border-bottom: 1px solid #000000;">
					  					  <p>未确诊患者信息</p>
					  				  </div>
					  				  <div style="margin: 5px;">
					  						<el-table
					  						    :data="register"
					  						    border>
					  						    <el-table-column
					  						      fixed
					  						      prop="caseNumber"
					  						      label="病历号"
					  						      width="75%">
					  						    </el-table-column>
					  						    <el-table-column
					  						      prop="realName"
					  						      label="姓名"
					  						      width="75%">
					  						    </el-table-column>
					  						    <el-table-column
					  						      prop="age"
					  						      label="年龄"
					  						      width="75%">
					  						    </el-table-column>
					  						    <el-table-column
					  						      fixed="right"
					  						      label="操作"
					  							  width="60%">
					  						      <template slot-scope="scope">
					  						        <el-button @click="handleClick(scope.row.id,scope.row.realName,scope.row.caseNumber)" type="text" size="small" icon="el-icon-edit"></el-button>
					  						      </template>
					  						    </el-table-column>
					  						  </el-table>
					  				 </div>
				</el-aside>
			<el-main>
				<div style="height: 30px; background-color: #D7D7D7;">
					<span style="padding: 0px 20px;">门诊病历信息</span>
					<span>{{Name}}</span>
				</div>
				<div style="padding-top: 20px;">
					<el-form ref="Userimg" :model="Userimg" label-width="80px">
					  <el-form-item label="主诉">
					    <el-input placeholder="请填写主诉" v-model="Userimg.readme"></el-input>
					  </el-form-item>
					  <el-form-item  label="现病史">
					    <el-input placeholder="请填写现病史" v-model="Userimg.present"></el-input>
					  </el-form-item>
					  <el-form-item label="现病治疗情况">
					    <el-input placeholder="请填写现病治疗情况" v-model="Userimg.presentTreat"></el-input>
					  </el-form-item>
					  <el-form-item label="既往史">
					    <el-input placeholder="请填写既往史" v-model="Userimg.history"></el-input>
					  </el-form-item>
					  <el-form-item label="过敏史">
					    <el-input placeholder="请填写过敏史" v-model="Userimg.allergy"></el-input>
					  </el-form-item>
					  <el-form-item label="体格检查">
					    <el-input placeholder="请填写体格检查" v-model="Userimg.physique"></el-input>
					  </el-form-item>
					  <el-form-item label="检查建议">
					    <el-input placeholder="请填写检查建议" v-model="Userimg.proposal"></el-input>
					  </el-form-item>
					  <el-form-item label="注意事项">
					    <el-input placeholder="请填写注意事项" v-model="Userimg.careful"></el-input>
					  </el-form-item>
					  <el-form-item label="诊断结果">
					    <el-input placeholder="请填写诊断结果" v-model="Userimg.diagnosis"></el-input>
					  </el-form-item>
					  <el-form-item label="处理意见">
					    <el-input placeholder="请填写处理意见" v-model="Userimg.handling"></el-input>
					  </el-form-item>
					</el-form>
					<div style="text-align: center;">
						<el-button @click="submit()">确诊</el-button>
					</div>
					
				</div>
			</el-main>
		</el-container>
	</div>
</template>

<script>
	export default {
		name:"OutpatientDiagnosis",
		data() {
			return {
				user: {
					RealName: '',
					CaseNumber: '',
				},
				id:'',
				casenumber:'',
				Name: '',
				Userimg:{
					ID:'',
					Readme:'',
					Present:'',
					PresentTreat:'',
					History:'',
					Allergy:'',
					Physique:'',
					Proposal:'',
					Careful:'',
					Diagnosis:'',
					Handling:'',
				},
				register: []
			}
		},
		mounted() {
			this.selectRegister()
		},
		methods: {
			submit(){
				this.Userimg.ID=this.id;
				let url = '/outpatientDiagnosis/Diagnosisimg'
				let param = this.$qs.stringify(this.Userimg);
				this.$axios.post(url, param)
					.then((resp) => {
						this.$message(resp.data);
					})
					.catch((err) => {
						console.log('error=', err);
					})
			},
			selectRegister() {
				let url = '/outpatientDiagnosis/selectNoDiagnosisRegister'
				let param = this.$qs.stringify(this.user);
				this.$axios.post(url, param)
					.then((resp) => {
						this.register = resp.data;

					})
					.catch((err) => {
						console.log('error=', err);
					})
			},
			selectSingleimg(){
				let url = '/outpatientDiagnosis/inquireHomeInfromation'
				var singleUser={
					CaseNumber:""
				}
				singleUser.CaseNumber=this.casenumber;
				let param = this.$qs.stringify(singleUser);
				this.$axios.post(url, param)
					.then((resp) => {
						this.Userimg = resp.data;
						this.id = this.Userimg.id;
					})
					.catch((err) => {
						console.log('error=', err);
					})
			},
			handleClick(id,realname,casenumber) {
				this.Name = realname;
				this.casenumber = casenumber;
				this.selectSingleimg();
			}
		},
	}
</script>

<style scoped="scoped">
	.selectRegister {
		padding: 10px 15px;
		border-bottom: 1px solid black;
	}
	.el-main {
		padding: 0px;
		border-left: 1px solid black;
	}
	.el-aside{
		border-right: 1px solid black;
	}
</style>
